package com.foreknow.demo8;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        List<Student> list = new ArrayList<>();
        for(int i = 0;i < 3;i++) {
            System.out.println("请输入学号");
            int sid = input.nextInt();
            System.out.println("请输入姓名");
            String sname = input.next();
            System.out.println("请输入年龄");
            int age = input.nextInt();
            System.out.println("请输入学校");
            String school = input.next();
            System.out.println("请输入电话号");
            String phone = input.next();
            //创建学生对象并将接收到的数据保存到对象中
            Student student = new Student();
            student.setSid(sid);
            student.setSname(sname);
            student.setAge(age);
            student.setSchool(school);
            student.setPhone(phone);
            //将Student对象保存到List集合中
            list.add(student);
        }

        Manager manager = new Manager();
        manager.getStudentInfo(list);
        System.out.println("---------------------------------------------");
        Student student = manager.getQueryById(list,1002);
        System.out.println(student.getSname());

    }
}
